# singleton_pattern.py

class SingletonDatabase:
    _instance = None

    def __new__(cls):
        if cls._instance is None:
            cls._instance = super().__new__(cls)
            cls._instance.connection = "数据库连接"
        return cls._instance

# 测试
db1 = SingletonDatabase()
db2 = SingletonDatabase()
print(db1 is db2)  # 输出：True